onPrepareOptionsMenu

Deprecated

androidx.activity.ComponentActivity now implements MenuHost, an interface that allows any component, including your activity itself, to add menu items by calling addMenuProvider without forcing all components through this single method override. The MenuProvider interface uses a single onCreateMenu method for managing both the creation and preparation of menu items. Replace usages of this method with one or more calls to addMenuProvider in your Activity's onCreate method, moving any preparation of menu items to onPrepareMenu.

Prepare the Fragment host's standard options menu to be displayed. This is called right before the menu is shown, every time it is shown. You can use this method to efficiently enable/disable items or otherwise dynamically modify the contents. See Activity.onPrepareOptionsMenu for more information.

Parameters

menu

The options menu as last shown or first initialized by onCreateOptionsMenu().

See also